package com.lone.smallmovie.controller;

import com.lone.smallmovie.model.Video;
import com.lone.smallmovie.service.impl.VideoServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping(value = "/video")
public class VideoController {

    @Autowired
    private VideoServiceImpl videoService;


    @RequestMapping(value = "/getVideoList")
    @ResponseBody
    public Map<String,Object> getVideoList(){
        Map<String,Object> map = new HashMap<String, Object>();

        List<Video> list = videoService.queryVideo();
        if (list != null){
            map.put("status", "0");
            map.put("message", "获取视频列成功！");
            map.put("videoList",list);
        }else {
            map.put("status", "1");
            map.put("message", "获取视频列失败！");
        }

        return map;
    }
}
